import java.util.Scanner;

public class Main {

    //全排列的价值
    static final int MOD = 998244353;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        long[] f = new long[n + 1];
        f[1] = 0;
        long p = 1;  // 阶乘初始化为 1

        for (int i = 1; i < n; i++) {
            p = p * i % MOD;
            f[i + 1] = (i * (i + 1L) / 2L % MOD * p % MOD + f[i] * (i + 1L) % MOD) % MOD;
            f[i + 1] %= MOD;
        }

        System.out.println(f[n]);
    }


    // f(n) = f(n - 1) * n + {(n * (n - 1)) / 2} * n!
}
